﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DispatchAssist.BusinessLogical.Model
{
    public class ACARSMsg
    {
        /// <summary>
        /// ACARSMsg 构造函数
        /// </summary>
        public ACARSMsg()
        { }


        /// <summary>
        /// ACARSMsg OR映射构造函数
        /// </summary>
        public ACARSMsg(System.Data.IDataReader dr)
        {
            this.ACARSMsgID = (Guid)dr["ACARSMsgID"];
            this.AlertID = (Guid)dr["AlertID"];
            this.ReceiveTailNo = Convert.ToString(dr["ReceiveTailNo"]);
            this.MsgBody = Convert.ToString(dr["MsgBody"]);
            this.MsgStatus = Convert.ToInt32(dr["MsgStatus"]);
            this.LastSendTime = Convert.ToDateTime(dr["LastSendTime"]);
            this.RetryCount = Convert.ToInt32(dr["RetryCount"]);
            this.Receipt = Convert.ToString(dr["Receipt"]);
            this.ReceiptTime = Convert.ToDateTime(dr["ReceiptTime"]);
            this.LastModifyTime = Convert.ToDateTime(dr["LastModifyTime"]);
            this.DeleteFlag = Convert.ToBoolean(dr["DeleteFlag"]);
        }


        /// <summary>
        /// 唯一标识
        /// </summary>
        public Guid ACARSMsgID { get; set; }

        /// <summary>
        /// 对应的告警信息ID
        /// </summary>
        public Guid AlertID { get; set; }

        /// <summary>
        /// 接收飞机尾号
        /// </summary>
        public string ReceiveTailNo { get; set; }

        /// <summary>
        /// 消息体
        /// </summary>
        public string MsgBody { get; set; }

        /// <summary>
        /// 消息状态
        /// </summary>
        public int MsgStatus { get; set; }

        /// <summary>
        /// 上次发送时间
        /// </summary>
        public DateTime? LastSendTime { get; set; }

        /// <summary>
        /// 已重试次数
        /// </summary>
        public int RetryCount { get; set; }

        /// <summary>
        /// 回执
        /// </summary>
        public string Receipt { get; set; }

        /// <summary>
        /// 回执时间
        /// </summary>
        public DateTime? ReceiptTime { get; set; }


        public string RcvAddress { get; set; }

        public string SendAddress { get; set; }

        public bool NeedReceipt { get; set; }

        public bool NeedNullSet { get; set; }

        public string Smi { get; set; }

        /// <summary>
        /// 最后修改时间
        /// </summary>
        public DateTime LastModifyTime { get; set; }

        /// <summary>
        /// 逻辑删除标记
        /// </summary>
        public bool DeleteFlag { get; set; }

        public override string ToString()
        {
            return string.Format("[接收飞机尾号：{0},消息内容：{1}]", ReceiveTailNo, MsgBody);
        }
    }
}
